﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.MacroEngines;

namespace DigibizAdvancedMediaPicker.RazorModel
{
    [RazorDataTypeModel("EF94C406-9E83-4058-A780-0375624BA7CA")]
    public class ModelBinder : IRazorDataTypeModel
    {
        public object PropertyData;
        public int CurrentNodeId;
        public bool Init(int CurrentNodeId, string PropertyData, out object instance)
        {
            this.PropertyData = PropertyData;
            this.CurrentNodeId = CurrentNodeId;
            if (string.IsNullOrEmpty(PropertyData))
            {
                instance = new DynamicNull();
                return true;
            }

            instance = new Model(PropertyData);
            return true;
        }
    }
}
